// 查询条件
export const formItem = [
  {
    label: '退货单号',
    value: 'returnNo',
    width: 6,
    type: 'text'
  },
  {
    label: '原出库单号',
    value: 'orderNo',
    width: 6,
    type: 'text'
  },
  {
    label: '客户姓名',
    value: 'customerName',
    width: 6,
    type: 'text'
  },
  {
    label: '单据状态',
    value: 'status',
    width: 6,
    type: 'select',
    children: [
      {
        label: '待提交',
        value: 'pending'
      },
      {
        label: '已提交',
        value: 'submitted'
      },
      {
        label: '已完成',
        value: 'completed'
      }
    ]
  },
  {
    label: '创建时间',
    value: 'startDate',
    width: 6,
    type: 'date'
  },
  {
    label: '至',
    value: 'endDate',
    width: 6,
    type: 'date'
  }
]

// 表头数据
export const tableHead = [
  {
    prop: 'returnNo',
    label: '退货单号',
    width: 120
  },
  {
    prop: 'orderNo',
    label: '原出库单号',
    width: 120
  },
  {
    prop: 'customerName',
    label: '客户姓名',
    width: 100
  },
  {
    prop: 'customerPhone',
    label: '客户电话',
    width: 120
  },
  {
    prop: 'totalAmount',
    label: '退货金额',
    width: 100
  },
  {
    prop: 'status',
    label: '单据状态',
    width: 100,
    render: (row) => {
      const statusMap = {
        'pending': { text: '待提交', type: 'warning' },
        'submitted': { text: '已提交', type: 'primary' },
        'completed': { text: '已完成', type: 'success' }
      }
      const status = statusMap[row.status] || { text: row.status, type: 'info' }
      return `<el-tag type="${status.type}">${status.text}</el-tag>`
    }
  },
  {
    prop: 'createTime',
    label: '创建时间',
    width: 160
  },
  {
    prop: 'creatorName',
    label: '创建人',
    width: 100
  },
  {
    prop: 'remark',
    label: '备注',
    width: 200
  }
]

// 详情数据
export const detailItem = [
  {
    label: '退货单号',
    value: 'returnNo',
    width: 12
  },
  {
    label: '原出库单号',
    value: 'orderNo',
    width: 12
  },
  {
    label: '客户姓名',
    value: 'customerName',
    width: 12
  },
  {
    label: '客户电话',
    value: 'customerPhone',
    width: 12
  },
  {
    label: '退货金额',
    value: 'totalAmount',
    width: 12
  },
  {
    label: '单据状态',
    value: 'status',
    width: 12
  },
  {
    label: '创建时间',
    value: 'createTime',
    width: 12
  },
  {
    label: '创建人',
    value: 'creatorName',
    width: 12
  },
  {
    label: '备注',
    value: 'remark',
    width: 24
  }
]

// 表单配置
export const formConfig = [
  {
    label: '原出库单号',
    prop: 'orderNo',
    type: 'input',
    placeholder: '请输入原出库单号或选择出库单'
  },
  {
    label: '客户姓名',
    prop: 'customerName',
    type: 'input',
    required: true,
    placeholder: '请输入客户姓名'
  },
  {
    label: '客户电话',
    prop: 'customerPhone',
    type: 'input',
    required: true,
    placeholder: '请输入客户电话'
  },
  {
    label: '退货原因',
    prop: 'returnReason',
    type: 'select',
    required: true,
    children: [
      { label: '质量问题', value: 'quality' },
      { label: '规格不符', value: 'specification' },
      { label: '客户取消', value: 'cancelled' },
      { label: '其他原因', value: 'other' }
    ]
  },
  {
    label: '商品信息',
    prop: 'products',
    type: 'table',
    required: true
  },
  {
    label: '退货金额',
    prop: 'totalAmount',
    type: 'number',
    required: true,
    placeholder: '请输入退货金额'
  },
  {
    label: '备注',
    prop: 'remark',
    type: 'textarea',
    placeholder: '请输入备注信息'
  }
] 